package com.cn.lb.predicate;

import com.netflix.loadbalancer.AbstractServerPredicate;
import com.netflix.loadbalancer.PredicateKey;
import com.netflix.loadbalancer.Server;
import org.springframework.lang.Nullable;

/**
 * @author: chenyuncong
 * @Date: 2020/3/10 16:02
 * 集成 断言路由 AbstractServerPredicate类
 */
public abstract class DefaultEnabledPredicate extends AbstractServerPredicate {

    @Override
    public boolean apply(@Nullable PredicateKey input) {
        return input != null
                && apply(input.getServer());
    }

    protected abstract boolean apply(Server server);


}
